package org.easyexcel.Test;

import org.easyexcel.Server.Interface.MyProxy;
import org.easyexcel.Server.MyProxyImp;
import org.junit.jupiter.api.Test;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;

public class Mycode {
    public static void main(String[] args) {
        ClassLoader classLoader = MyProxyImp.class.getClassLoader();
        Class[] interfaces = MyProxyImp.class.getInterfaces();
        MyProxy myProxy = (MyProxy) Proxy.newProxyInstance(classLoader, interfaces, (proxy, method, args1) -> {
            String invoke = null;
            if(method.getName().equals("test")){
                invoke = (String) method.invoke(MyProxyImp.class.getConstructor().newInstance(), args1);

            }
            return invoke;
        });
     myProxy.test();
    }

}
